//////////////////////////////////////////////////////////////////////////
//
// This file is a part of UKROP project.
// Copyright (c) Vladimir Gumenuk
//
// PROJECT:         Xort Custom Debug Engine
// FILE:            DisassemblyStream.h : Declaration of the CDisassemblyStream
// AUTHOR:          Vladimir Gumenuk
// DATE:            11-Jan-2013
// MODIFICATIONS:
//
//////////////////////////////////////////////////////////////////////////

#pragma once

//////////////////////////////////////////////////////////////////////////
// CDisassemblyStream
class ATL_NO_VTABLE CDisassemblyStream :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CDisassemblyStream, &CLSID_DisassemblyStream>,
	public IDebugDisassemblyStream2,
    public IXDisassemblyStream
{
public:
	CDisassemblyStream();
    virtual ~CDisassemblyStream();
	
DECLARE_REGISTRY_RESOURCEID(IDR_DISASSEMBLYSTREAM)

BEGIN_COM_MAP(CDisassemblyStream)
	COM_INTERFACE_ENTRY(IDebugDisassemblyStream2)
    COM_INTERFACE_ENTRY(IXDisassemblyStream)
END_COM_MAP()

DECLARE_PROTECT_FINAL_CONSTRUCT()

IMPLEMENT_CREATE(CDisassemblyStream, IXDisassemblyStream)

	HRESULT FinalConstruct();
	void FinalRelease();

public:
    STDMETHOD(Read)( DWORD dwInstructions, DISASSEMBLY_STREAM_FIELDS dwFields, DWORD *pdwInstructionsRead, DisassemblyData *prgDisassembly );
    STDMETHOD(Seek)( SEEK_START dwSeekStart, IDebugCodeContext2 *pCodeContext, UINT64 uCodeLocationId, INT64 iInstructions );
    STDMETHOD(GetCodeLocationId)( IDebugCodeContext2 *pCodeContext, UINT64 *puCodeLocationId );
    STDMETHOD(GetCodeContext)( UINT64 uCodeLocationId, IDebugCodeContext2 **ppCodeContext );
    STDMETHOD(GetCurrentLocation)( UINT64 *puCodeLocationId );
    STDMETHOD(GetDocument)( BSTR bstrDocumentUrl, IDebugDocument2 **ppDocument );
    STDMETHOD(GetScope)( DISASSEMBLY_STREAM_SCOPE *pdwScope );
    STDMETHOD(GetSize)( UINT64 *pnSize );


};

OBJECT_ENTRY_AUTO(__uuidof(DisassemblyStream), CDisassemblyStream)
